import QtQuick 1.0

Item {
    id: idHeader

    signal refresh
    signal logout

    Rectangle {
        anchors.fill: parent
        gradient: Gradient {
            GradientStop {
                position: 0.00;
                color: "#666666";
            }
            GradientStop {
                position: 0.50;
                color: "#111111";
            }
            GradientStop {
                position: 1.00;
                color: "#666666";
            }
        }
        opacity: 0.9
    }

    Image {
        id: idLogoImage
        source: "art/reload.png"
        width: 64
        height: 64
        anchors.verticalCenter: parent.verticalCenter
        anchors.left: parent.left
        anchors.leftMargin: 20

        smooth: true
        z: 3
        Behavior on rotation { NumberAnimation {duration: 100 } }
        MouseArea {
            id: idRefresh
            anchors.fill: parent
            onClicked: idHeader.refresh();
        }
        states: [
            State {
                name: "Pressed"
                when: idRefresh.pressed == true
                //PropertyChanges { target: idLogoImage; opacity: 0.5 }
                PropertyChanges { target: idLogoImage; rotation: -180 }
            }
        ]
    }


    Image {
        id: idRecommendImage
        source: "art/logo.png"
        width: 64
        height: 51
        anchors.verticalCenter: parent.verticalCenter
        anchors.horizontalCenter: parent.horizontalCenter
        smooth: true
        z: 2

        Behavior on scale { NumberAnimation {duration: 60 } }

        MouseArea {
            id: idLogoutMouseArea
            anchors.fill: parent
            onClicked: idHeader.logout();
        }
        states: [
            State {
                name: "Pressed"
                when: idLogoutMouseArea.pressed == true
                PropertyChanges { target: idRecommendImage; opacity: 0.9 }
                PropertyChanges { target: idRecommendImage; scale: 0.9 }
            }
        ]
    }

    Image {
        id: idHeaderBar
        source: "art/macapp_headerbar.png"
        anchors.top: parent.bottom
        height: 15
        width: parent.width
        z: 2
        opacity: 0.95
        smooth: true


    }

    Image {
        id: idQuitImage
        source: "art/shutdown.png"
        width: 58
        height: 58
        anchors.verticalCenter: idLogoImage.verticalCenter
        anchors.right: parent.right
        anchors.rightMargin: 20
        smooth: true
        z: 2
        Behavior on scale { NumberAnimation {duration: 60 } }

        MouseArea {
            id: idQuitMouseArea
            anchors.fill: parent
            onClicked: Qt.quit();
        }
        states: [
            State {
                name: "Pressed"
                when: idQuitMouseArea.pressed == true
                PropertyChanges { target: idQuitImage; opacity: 0.9 }
                PropertyChanges { target: idQuitImage; scale: 0.9 }
            }
        ]
    }


}
